#ifndef pagecontrol_H
#define pagecontrol_H
#include <QToolBar>

#include <qgraphicsitem.h>

class Page;

/**
 * A small toolbar that is displayed below each page and provides quick access for page
 * focused actions.
 */
class PageControl : public QObject, public QGraphicsItem
{
    Q_OBJECT

public:
    /**
     * Create a new PageControl for the given page.
     * @param parent The page that this control is used for.
     */
    PageControl(Page *parent);

    /**
     * DOCME
     */
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

    /**
     * Calculate the size of this QGraphicsItem.
     * @return QRectF with the size of the PageControl's toolbar.
     */
    virtual QRectF boundingRect() const;

    /**
     * The item type number used by the QGraphics framework.
     * Used to distinguish this item from other QGraphicsItems.
     *
     * And by Page::setScale() so this object is not scaled.
     */
    enum { Type = UserType + 2 };

    /**
     * Override the return function to return this implementation's type.
     */
    int type() const {return Type;}

private:
    /**
     * The toolbar that contains the usable elements.
     * TODO: Use a KToolBar?
     */
    QToolBar *m_toolBarWidget;

    /**
     * The proxy objects that displays the toolbar in the QGraphicsScene
     */
    QGraphicsProxyWidget *m_toolBarProxy;
};

#endif // pagecontrol_H
